package com.jframe.sys.webui;

import com.jframe.sys.controller.utils.Token;

public class ImgPlay {

	/**
	 * 功能说明：不带title的juqery图片轮播
	 * @param hrefs
	 * @param imgUrls
	 * @param width
	 * @param height
	 * @param hasTitle
	 * @return
	 */
	public static String getImgPlay(String[] hrefs,String[] imgUrls,int width,int height,boolean hasTitle ){
		String[] titles = new String[hrefs.length];
		for(int i=0;i<titles.length;i++){
			titles[i]="";
		}
		return getImgPlay(titles, hrefs, imgUrls, width, height, hasTitle);
	}
	
	/**
	 * 功能说明：带title的jquery图片轮播
	 * @param titles
	 * @param hrefs
	 * @param imgUrls
	 * @param width
	 * @param height
	 * @param hasTitle
	 * @return
	 */
	public static String getImgPlay(String[] titles,String[] hrefs,String[] imgUrls,int width,int height,boolean hasTitle ){
		StringBuffer str = new StringBuffer();
		String sliderId = Token.getRandomString(5);
		str.append("<script type=\"text/javascript\">");
		str.append("$(function(){");
			str.append("$("+"'#"+sliderId+"').KinSlideshow({");
				str.append("moveStyle:\"right\",");
				str.append("titleBar:{titleBar_height:20,titleBar_bgColor:\"#08355c\",titleBar_alpha:0},");
				str.append("titleFont:{TitleFont_size:12,TitleFont_color:\"#FFFFFF\",TitleFont_weight:\"normal\"},");
			    str.append("btn:{btn_bgColor:\"#FFFFFF\",btn_bgHoverColor:\"#1072aa\",btn_fontColor:\"#000000\",");
				str.append("btn_fontHoverColor:\"#FFFFFF\",btn_borderColor:\"#cccccc\",");
				str.append("btn_borderHoverColor:\"#1188c0\",btn_borderWidth:1}");
			str.append("});");
		str.append("});");
		str.append("</script>");
		//生成html		
		str.append("<div id=\""+sliderId+"\" style=\"visibility:hidden;\">");
		for(int i=0;i<titles.length;i++){
			str.append("<a href=\""+hrefs[i]+"\" title=\""+titles[i]+"\"><img src=\""+imgUrls[i]+"\" alt=\""+titles[i]+"\" style=\"width:"+width+"px;height:"+height+"px;\"></a>");
		}
		str.append("</div>");
		return str.toString();
	}
	
}
